package com.ruoyi.whzj.service.impl;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.whzj.mapper.WhUserMapper;
import com.ruoyi.whzj.domain.WhUser;
import com.ruoyi.whzj.service.IWhUserService;
import com.ruoyi.common.core.text.Convert;

/**
 * 用户Service业务层处理
 * 
 * @author ruoyi
 * @date 2020-10-15
 */
@Service
public class WhUserServiceImpl implements IWhUserService 
{
    @Autowired
    private WhUserMapper whUserMapper;

    /**
     * 查询用户
     * 
     * @param id 用户ID
     * @return 用户
     */
    @Override
    public WhUser selectWhUserById(String id)
    {
        return whUserMapper.selectWhUserById(id);
    }

    @Override
    public List<WhUser> selectWhUserByPCode(String pCode)
    {
        return whUserMapper.selectWhUserByPCode(pCode);
    }

    @Override
    public List<WhUser> selectWhUserByUserId(String userId)
    {
        return whUserMapper.selectWhUserByUserId(userId);
    }

    @Override
    public List<WhUser> selectWhUserByPPCode(String pCode)
    {
        return whUserMapper.selectWhUserByPPCode(pCode);
    }

    public List<WhUser> selectUserByPPCode(String pCode){
        return whUserMapper.selectUserByPPCode(pCode);
    }

    @Override
    public List<WhUser> selectWhUserByLevel() {
        return whUserMapper.selectWhUserByLevel();
    }

    @Override
    public Map<String, Object> getNextUserNum(String pCode)
    {
        return whUserMapper.getNextUserNum(pCode);
    }


    @Override
    public WhUser selectWhUserByKuaiId(String id)
    {
        return whUserMapper.selectWhUserByKuaiId(id);
    }

    public WhUser selectWhUserByKuaiNumber(String number){
        return whUserMapper.selectWhUserByKuaiNumber(number);
    }

    @Override
    public WhUser selectWhUserByCodeId(String id)
    {
        return whUserMapper.selectWhUserByCodeId(id);
    }

    /**
     * 查询用户列表
     * 
     * @param whUser 用户
     * @return 用户
     */
    @Override
    public List<WhUser> selectWhUserList(WhUser whUser)
    {
        return whUserMapper.selectWhUserList(whUser);
    }

    /**
     * 新增用户
     * 
     * @param whUser 用户
     * @return 结果
     */
    @Override
    public int insertWhUser(WhUser whUser)
    {
        whUser.setCreateTime(DateUtils.getNowDate());
        return whUserMapper.insertWhUser(whUser);
    }

    /**
     * 修改用户
     * 
     * @param whUser 用户
     * @return 结果
     */
    @Override
    public int updateWhUser(WhUser whUser)
    {
        return whUserMapper.updateWhUser(whUser);
    }

    @Override
    public int updateWhUserBalance(WhUser whUser) {
        return whUserMapper.updateWhUserBalance(whUser);
    }

    @Override
    public int updateWhUserIntegral(WhUser whUser) {
        return whUserMapper.updateWhUserIntegral(whUser);
    }

    @Override
    public int updateWhUserExperience(WhUser whUser) {
        return whUserMapper.updateWhUserExperience(whUser);
    }

    /**
     * 删除用户对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteWhUserByIds(String ids)
    {
        return whUserMapper.deleteWhUserByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除用户信息
     * 
     * @param id 用户ID
     * @return 结果
     */
    @Override
    public int deleteWhUserById(String id)
    {
        return whUserMapper.deleteWhUserById(id);
    }

    @Override
    public int updateWhUserCheckFlag() {
        return whUserMapper.updateWhUserCheckFlag();
    }

    @Override
    public Long getBalanceSum() {
        return whUserMapper.getBalanceSum();
    }
}
